<extend name="layout:index"/>
<block name="style">
	<style>
		#alter{
			/*margin-left: 25%;*/
			border:1px solid #aaa;
			width:300px;
			height:150px;
			/*background:red;*/
			position:fixed;
			left:40%;
			top:30%;
			background:skyblue;
			z-index:999;
			display:none;
		}
	</style>
</block>
<block name="content">
	<div class="mws-panel grid_8">
	<div class="mws-panel-header">
		<span><i class="icon-table"></i>管理中心-会员级别</span>
	</div>
	<div class="mws-panel-body no-padding">
		<div id="DataTables_Table_1_wrapper" class="dataTables_wrapper" role="grid">
			
			<table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1" aria-describedby="DataTables_Table_1_info">
			    <thead>
			        <tr role="row">
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending" width="10">编号
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending" width="10">名称
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="Browser: activate to sort column ascending" >注册金额
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="Platform(s): activate to sort column ascending">推荐奖
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="Engine version: activate to sort column ascending">对碰奖
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending">对碰奖日封顶
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending">代数奖
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending">代数奖层数
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending">配送比例
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending">持股上限
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending" width="50">交易奖
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending">交易奖层数
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending">出局股数
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending">开放注册
				        </th>
				        <th class="" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1"  aria-label="CSS grade: activate to sort column ascending">会员升级
				        </th>
			        </tr>
			    </thead>
				<tbody role="alert" aria-live="polite" aria-relevant="all">
				<volist name='jibie' id="vo">
					<!-- <form action="/admin/user/shengjihuiyuan" method="post">	 -->
					<tr class="odd">
			            <td class="">{$vo.id}</td>
			            <td><span class="edit" name="name" bid="{$vo['id']}">{$vo.name}</span></td>
			            <td><span class="edit" name="reg_amount" bid="{$vo['id']}">{$vo.reg_amount}</span></td>
			            <td><span class="edit" name="zt_percent" bid="{$vo['id']}">{$vo.zt_percent}</span><span>%</span></td>
			            <td><span class="edit" name="dp_percent" bid="{$vo['id']}">{$vo.dp_percent}</span><span>%</span></td>
			            <td><span class="edit" name="dp_max_amount" bid="{$vo['id']}">{$vo.dp_max_amount}</span></td>
			            <td><span class="edit" name="jd_percent" bid="{$vo['id']}">{$vo.jd_percent}</span><span>%</span></td>
			            <td><span class="edit" name="jd_level" bid="{$vo['id']}">{$vo.jd_level}</span></td>
			            <td><span class="edit" name="pay_amount" bid="{$vo['id']}">{$vo.pay_amount}</span><span>%</span></td>
			            <td><span class="edit" name="max_amount" bid="{$vo['id']}">{$vo.max_amount}</span></td>
			            <td><span class="edit" name="jy_percent" bid="{$vo['id']}">{$vo.jy_percent}</span><span>%</span></td>
			            <td><span class="edit" name="jy_level" bid="{$vo['id']}">{$vo.jy_level}</span></td>
			            <td><span class="edit" name="out_amount" bid="{$vo['id']}">{$vo.out_amount}</span></td>
			            <td class="n">
			            	<if condition="$vo.is_reg eq 1">
			            	<img src="__PUBLIC__/yes.gif" alt="" class="tupian" name="{$vo.id}" ico="{$vo.is_reg}">
			            	<else/>
			            	<img src="__PUBLIC__/no.gif" alt="" class="tupian" name="{$vo.id}" ico="{$vo.is_reg}">
			            	</if>
			            </td>
			            <td>            	
			            	<if condition="$vo.id eq 3">
			            		<form action="/admin/user/shengjihuiyuan" method="post">
			            		<input type="hidden" name="tid" value="{$vo.id}">
			            		<select name="id" id="" class="id" >
				            		<option value="0">请选择</option>
							       	<option value="5">VIP2</option>
							       	<option value="10">VIP3</option>
							       	<option value="30">VIP4</option>
							       	<option value="50">VIP5</option>
							       	<option value="100">VIP6</option>
							       	</select>
						       	<button class="btn  btn-small shengji">升级</button>
						       	</form>
						    <elseif condition="$vo.id eq 5"/>
						    	<form action="/admin/user/shengjihuiyuan" method="post">
						    	<input type="hidden" name="tid" value="{$vo.id}">
						   	 	<select name="id" id="">
							    	<option value="0">请选择</option>
							       	<option value="10">VIP3</option>
							       	<option value="30">VIP4</option>
							       	<option value="50">VIP5</option>
							       	<option value="100">VIP6</option>
							       	</select>
						       	<button class="btn  btn-small shengji">升级</button>
						       	</form>
						    <elseif condition="$vo.id eq 10"/>
						    	<form action="/admin/user/shengjihuiyuan" method="post">
						    	<input type="hidden" name="tid" value="{$vo.id}">
						    	<select name="id" id="">
							    	<option value="0">请选择</option>
							       	<option value="30">VIP4</option>
							       	<option value="50">VIP5</option>
							       	<option value="100">VIP6</option>
							       	</select>
						       	<button class="btn  btn-small shengji">升级</button>
						       	</form>
						    <elseif condition="$vo.id eq 30"/>
						    	<form action="/admin/user/shengjihuiyuan" method="post">
						    	<input type="hidden" name="tid" value="{$vo.id}">
						    	<input type="hidden" value="{$vo.id}">
						    	<select name="id" id="">
							     	<option value="0">请选择</option>
							       	<option value="50">VIP5</option>
							       	<option value="100">VIP6</option>
							       	</select>
						       	<button class="btn  btn-small shengji">升级</button>
						       	</form>
							<elseif condition="$vo.id eq 50"/>
								<form action="/admin/user/shengjihuiyuan" method="post">
								<input type="hidden" name="tid" value="{$vo.id}">
								<select name="id" id="">
									<option value="0">请选择</option>
							       	<option value="100">VIP6</option>
						       	</select>
						       	<button class="btn  btn-small shengji">升级</button>
						       	</form>
						    <else/>
						    	已到最高级别
						    </if>
			            </td>
			        </tr>
			        <!-- </form> -->
			    </volist>
				</tbody>
			</table>
			<div class="dataTables_info" id="DataTables_Table_1_info"></div>
			<div class="dataTables_paginate paging_full_numbers" id="DataTables_Table_1_paginate">
				{$url}
			</div>
		</div>
    </div>
</div>
<div id="alter">
	<div>
    	<div style="margin:auto;width:50%">请输入要修改的数值：</div><br>
		<div style="margin:auto;width:50%"><input type="text" id="shuju"><div><br>
		<div style="margin:auto;width:70%"><button id="xiugai" class="btn  btn-small">修改</button>　<button id="guan" class="btn  btn-small">关闭</button></div>
	</div>
</div>
<script>
	 $.ajaxSetup({
         headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
         }
    });

	$('.edit').click(function(){
		var i = $(this).text();
		bid = $(this).attr('bid');
		shuxing = $(this).attr('name');
		$('#alter').css('display','block');
		$('#shuju').val(i);
	});

	$('.tupian').click(function(){
		var ico = $(this).attr('ico');
		var id = $(this).attr('name');
		var i = $(this).parent().parent().index();
		$.ajax({
		   type: "POST",
		   url: "/admin/user/edit1",
		   data: {is_reg:ico,id:id},
		   async: false,
		   success: function(str){
		   		if(str == 1){
		   			if(ico == 1){
		   				$('.tupian').eq(i).attr('src','__PUBLIC__/no.gif');
		   				$('.tupian').eq(i).attr('ico','0');
		   				alert('成功开通');
		   			}else{
		   				$('.tupian').eq(i).attr('src','__PUBLIC__/yes.gif');
		   				$('.tupian').eq(i).attr('ico','1');
		   				alert('成功开通');
		   			}
		   		}else{
		   			alert('开通失败');
		   		}
		   }
		});
	});
	$('#guan').click(function(){
		$('#alter').css('display','none');
	});

	$('#xiugai').click(function(){
		var a = $('#shuju').val();
		$('#alter').css('display','none');
		$.ajax({
		   type: "POST",
		   url: "/admin/user/edit",
		   data: {id:bid,name:shuxing,shuju:a},
		   async: false,
		   success: function(str){
		     if(str){
		     	window.location.href = '';
		     }else{
		     	alert('你未修改原始数据或修改失败');
		     }
		   }
		});
	});


	
</script>
</block>